home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / IBPalettes / WW3DKit / WW3DCamera.h < prev    next >
Encoding:
Text File  |  1995-05-16  |  7.2 KB  |  281 lines

  1. // copyright 1993 Michael B. Johnson; some portions copyright 1994, MIT
  2. // see COPYRIGHT for reuse legalities
  3. //
  4.  
  5. #import <appkit/appkit.h>
  6. #import <3Dkit/3Dkit.h>
  7.  
  8. @interface WW3DCamera:N3DMovieCamera
  9. {
  10.   id       tclInterp;
  11.   id       theRotator;
  12.   id       theShader;
  13.   id       ambientLight, leftLight, rightLight;
  14.   id       currentShape;
  15.   id       statusText;
  16.   int      statusBufSize;
  17.   char     *statusBuf;
  18.   char     *ribName;
  19.   int      renderStyle;
  20.   int      movingRenderStyle;
  21.   float    shadingRate;
  22.   NXColor  ribColor;
  23.   RtFloat  tesselationVector[2];
  24.   RtFloat  lowRezTesselationVector[2];
  25.  
  26.   BOOL     showSelectedShape, drawOriginForSelectedShape, useRendribInstead, binaryRIB;
  27.   char     *format;
  28.  
  29.   id       image;
  30.  
  31.   List     *otherLightList;
  32.   List     *ribCommandList;
  33.        
  34.   DPSTimedEntry  animateTE;
  35.   BOOL           animateRotate;
  36.   BOOL           animateScale;
  37.   BOOL           animateTranslate;
  38.  
  39.   DPSTimedEntry  renderTE;
  40.   int            renderCount;
  41.   int            renderAtMediumRate;
  42.   int            renderAtHighRate;
  43.   float          renderCheckTimeSlice;
  44.  
  45.   NXRect     selectionRegion;
  46.   float      selectionWidthEpsilon, selectionHeightEpsilon;
  47.   int        trackballAffects;
  48.   // avoid the stack allocation for timed entries
  49.   NXPoint    oldMouse, newMouse, dMouse;
  50.   RtMatrix   rmat, irmat;
  51.   float      scaleUpFactor,
  52.              scaleDownFactor,
  53.              translateXFactor,
  54.              translateYFactor,
  55.              translateZFactor,
  56.              epsilon;
  57.  
  58.   BOOL       defaultLightsInUse;
  59.  
  60.   RtFloat    fStop, focalLength, focalDistance;
  61.   
  62.   BOOL       inSynchWithTclInterp;
  63.   BOOL       evaluateInterpProc;
  64.  
  65.   RtFloat    shutterOpenTime;
  66.   RtFloat    exposureLength;  // shutterCloseTime always equals (shutterOpenTime + (exposureLength * exposureLengthFactor))
  67.   RtFloat    savedExposureLength;  // this is so we can unset it for non-shot rendering
  68.   RtFloat    frameTimeIncrement;  // when the frameNumber is incremented, the shutterOpenTime is incremented by this value
  69.   RtFloat    framesPerSecond;
  70.   float      shotLength; // how long, in seconds, is the shot
  71.   float      shotStartTime; // where, in the scene and in seconds, does the shot begin
  72.   float      exposureLengthFactor; // a 0 to 1 corresponding to what percentage of the possible time the shutter is left open during a shot
  73.   int        shotOutputType;
  74.  
  75.   BOOL       shooting;
  76.   BOOL       dumpingToRIB;
  77.   BOOL       justResetExposureLength;
  78.   BOOL       justFinishedShooting;
  79.  
  80.   BOOL       backgroundRendering;
  81.   id         sceneClock;
  82.  
  83.   BOOL       drawWorldAsBox, drawCurrentAsBox;
  84.   
  85.   // support for direct interaction...
  86.   BOOL updateShape;
  87.   BOOL updateWhenTracking;
  88.   BOOL changeSelectedShape;
  89.  
  90.   // 3DTextScene stuff
  91.   char   *fontName;
  92.   float  fontSize;
  93.   float  fontSpacing;
  94.   float  spacingFactor;
  95.   float  tabLength;
  96.   float  timeFactor;
  97.   float  sampleOffset;
  98.  
  99.   id     runTimeSystem;
  100. }
  101.  
  102. + initialize;
  103.  
  104. - initFrame:(const NXRect *)r;
  105. - awake;
  106. - free;
  107.  
  108. - setRunTimeSystem:newRTS;
  109.  
  110. - getTransformMatrix:(RtMatrix)aMatrix;
  111.  
  112. - removeAnimateTE;
  113.  
  114. - (BOOL)backgroundRendering;
  115. - setBackgroundRenderingOff;
  116.  
  117. - removeDefaultLights;
  118. - restoreDefaultLights;
  119. - removeLightNamed:(const char *)lightName;
  120.  
  121. - delegate;
  122.  
  123. - setImage:i;
  124. - setImageFile:(const char *)filename;
  125. - saveImage:sender;
  126.    
  127. - turnOffCropWindow;
  128.  
  129. - setSceneClock:newSceneClock;
  130.  
  131. - dumpRIB:sender;
  132. - dumpRIBToFile:(char *)filename;
  133. - dumpShotToRIB:sender;
  134. - dumpShotToRIBFile:(const char *)longFilename;
  135. - dumpEve:sender;
  136. - dumpScene:sender;
  137. - dump3DTextScene:sender;
  138.  
  139. - tclInterp;
  140.  
  141. #define WW_TRACKBALL_WORLD_SHAPE    0
  142. #define WW_TRACKBALL_CAMERA         1
  143. #define WW_TRACKBALL_CURRENT_SHAPE  2 
  144.  
  145. - (int)trackballAffects;
  146. - takeTrackballAffectsFromMatrix:sender;
  147. - (int)trackballXYZ;
  148. - takeTrackballXYZFromMatrix:sender;
  149. - setNoCurrentShape:sender;
  150. - currentShape;
  151. - setCurrentShape:newCurrentShape;
  152. - (RtFloat)tesselation;
  153. - setTesselation:(RtFloat)newValue;
  154. - takeTesselation:sender;
  155. - (RtFloat)lowRezTesselation;
  156. - setLowRezTesselation:(RtFloat)newValue;
  157. - takeLowRezTesselation:sender;
  158. - (float)shadingRate;
  159. - takeShadingRate:sender;
  160.  
  161. - (BOOL)showSelectedShape;
  162. - setShowSelectedShape:(BOOL)flag; 
  163. - (BOOL)drawOriginForSelectedShape;
  164. - setDrawOriginForSelectedShape:(BOOL)flag;
  165.  
  166. - takeStatusText:sender;
  167. - setStatusText:newStatusText;
  168. - statusText;
  169.  
  170. - (BOOL)binaryRIB;
  171. - setBinaryRIB:(BOOL)n;
  172. - takeBinaryRIB:sender;
  173.  
  174. - takeAmbientLightState:sender;
  175. - takeAmbientLightIntensity:sender;
  176. - takeAmbientLightColor:sender;
  177. - takeLeftLightState:sender;
  178. - takeLeftLightIntensity:sender;
  179. - takeLeftLightColor:sender;
  180. - takeRightLightState:sender;
  181. - takeRightLightIntensity:sender;
  182. - takeRightLightColor:sender;
  183.  
  184. - takeRenderWorldAsBox:sender;
  185. - takeRenderCurrentAsBox:sender;
  186. - takeWorldIsVisible:sender;
  187. - takeCurrentIsVisible:sender;
  188.  
  189. - (BOOL)renderWorldAsBox;
  190. - (BOOL)renderCurrentAsBox;
  191. - (BOOL)worldIsVisible;
  192. - (BOOL)currentIsVisible;
  193.  
  194. - (BOOL)ambientLightState;
  195. - (RtFloat)ambientLightIntensity;
  196. - (NXColor)ambientLightColor;
  197. - (BOOL)leftLightState;
  198. - (RtFloat)leftLightIntensity;
  199. - (NXColor)leftLightColor;
  200. - (BOOL)rightLightState;
  201. - (RtFloat)rightLightIntensity;
  202. - (NXColor)rightLightColor;
  203.  
  204. - updateShapeForInteraction:(BOOL)provideUpdates whenTracking:(BOOL)trackShape;
  205. - shouldChangeSelected:(BOOL)changeSelected;
  206.  
  207. - mouseDown:(NXEvent *)theEvent;
  208.  
  209. - (RtFloat)fStop;
  210. - (RtFloat)focalLength;
  211. - (RtFloat)focalDistance;
  212. - (RtFloat)shutterOpenTime;
  213. - (RtFloat)shutterCloseTime;
  214. - (float)frameTimeIncrement;
  215. - (float)frameTimeIncrement;
  216.  
  217. - synchToSceneClock:sceneClock;
  218.  
  219. - (BOOL)shooting;
  220.  
  221. - removeAnimateTE;
  222. - animateRotate;
  223. - animateScale;
  224. - animateTranslate;
  225. void animateHandler(DPSTimedEntry teNumber, double now, void *userData);
  226. - removeRenderTE;
  227. - backgroundRender;
  228. void renderHandler(DPSTimedEntry teNumber, double now, void *userData);
  229.  
  230. - setMovingRenderStyle:(int)s;
  231. - (int)movingRenderStyle;
  232. - setRenderStyle:(int)s;
  233. - (int)renderStyle;
  234. - (NXColor) backgroundColor;
  235. - setBackgroundColor:(NXColor)c;
  236.  
  237. - (RtFloat)shutterOpenTime;
  238. - setShutterOpenTime:(RtFloat)newShutterOpenTime;
  239. - (RtFloat)shutterCloseTime;
  240. - (float)frameTimeIncrement;
  241. - (float)exposureLength;
  242. - (float)framesPerSecond;
  243. - (float)shotLength;
  244.  
  245. - takeExposureLengthFactor:sender;
  246. - takeShotStartTime:sender;
  247. - (float)exposureLengthFactor;
  248. - (float)shotStartTime;
  249. - setExposureLengthFactor:(float)newExposureLengthFactor;
  250. - setShotStartTime:(float)newShotStartTime;
  251.  
  252. - otherLightList;
  253. - addLocalLight:light usingPath:(const char *)aParentPath;
  254.  
  255. - read:(NXTypedStream *)stream;
  256. - write:(NXTypedStream *)stream; 
  257.  
  258. @end
  259.  
  260. // this camera has a tcl interp inside it that, in addition to
  261. // responding to all the standard tcl 7.3 commands, responds to:
  262. // dumpRIBToFile filename
  263. // display
  264. // backgroundColor [{r g b}]
  265. // fieldOfView [fov]
  266. // setEyeAtTowardRoll fromPoint toPoint aRollAngle
  267. // moveEyeBy sDistance tDistance uDistance
  268. // getEyePoint
  269. // getViewPoint
  270. // getRollAngle
  271. // getEyeAtTowardRoll
  272. // setSurfaceTypeForAll PointCloud|WireFrame|ShadedWireFrame|FacetedSolids|SmoothSolids
  273. // removeDefaultLights
  274. // restoreDefaultLights
  275. // lightList
  276. // addAmbientLight name intensity 
  277. // addPointLight name fromX fromY fromZ intensity 
  278. // addDistantLight name fromX fromY fromZ toX toY toZ intensity 
  279. // addSpotLight name fromX fromY fromZ toX toY toZ coneAngle coneDelta beamDistribution intensity 
  280. // removeLight name
  281.